// interface PersonInterface { 
//   name: string;
//   age: number;
//   speak(): void;
// }

// type PersonType = { 
//   name: string;
//   age: number;
//   speak(): void;
// }

// let p1: PersonInterface = { 
//   name: '张三', 
//   age: 18,
//   speak() {
//     console.log(`我叫${this.name},今年${this.age}岁`)
//   }
// }

// let p2: PersonType = { 
//   name: '张三', 
//   age: 18,
//   speak() {
//     console.log(`我叫${this.name},今年${this.age}岁`)
//   }
// }


// interface合并
interface PersonInterface { 
  name: string;
  age: number;
}
interface PersonInterface { 
  speak(): void;
}
interface StuInterface extends PersonInterface { 
  score: number;
}

const stu: StuInterface = { 
  name: '张三', 
  age: 18,
  score: 100,
  speak() {
    console.log(`我叫${this.name},今年${this.age}岁`)
  }
}


// type通过 & 进行合并
type PersonType = { 
  name: string;
  age: number;
} & { 
  speak(): void;
}

type StuType = PersonType & { 
  score: number;
}




export {}